﻿@using Daheng.Domain
@using GMS.Framework.Web.Controls
@using BookManager.Domain;
@model Books
@{
    Layout = "~/Views/Shared/_Layout.Edit.cshtml";
}
@section PageSpecificStyleSheetIncludes{
    <style type="text/css">
        .controls label
        {
            display:inline;
        }
    </style>
}
@section PageSpecificJavascriptIncludes{
}
@section MainContent{
<div class="portlet-body form-horizontal form-bordered form-row-stripped">
    <div class="row-fluid"> 

            <div class="control-group">
                <label class="control-label"><span class="required">*</span>书名：</label>
                <div class="controls">
                @Html.TextBoxFor(m => m.name, new { @class = "m-wrap" })
                @Html.HiddenFor(m=>m.Path)
                <span class="help-inline">@Html.ValidationMessageFor(m => m.name)</span><span class="help-inline"><a id="btnRenameFile" />更新</a>
</div>
            </div>

            <div class="control-group">
                <label class="control-label">描述：</label>
                <div class="controls">
                @Html.TextBoxFor(m => m.desc, new { @class = "m-wrap" })
              
                </div>
            </div>

            <div class="control-group">
                <label class="control-label"><span class="required">*</span>MD5：</label>
                <div class="controls">
                @Html.TextBoxFor(m => m.md5, new { @class = "m-wrap" })
                <span class="help-inline">@Html.ValidationMessageFor(m => m.md5)</span>
                </div>
            </div>

    </div>
</div>
}

<script>
    var filePath = "";
    $(function () {
        filePath = $("#Path").val();
        $("#name").change(function () {
            var newFile = $("#name").val();
            var oldFile = filePath.replace(/^.+?\\([^\\]+?)(.[^.\\]*?)?$/i, "$1");
            newFile = filePath.replace(oldFile, newFile);
            $("#btnRenameFile").prop("href", "Book://update-file$:" + filePath + "$:" + newFile + "");
        });

    })

</script>

